#include "camprec.h"
#include "DrawText.h"

//DWORD CDrawText::m_ID = 0;


CDrawText::CDrawText(void)//:IDOGL(0)
{

	//m_ID++;
	//StrID (mystr::format(_T("DrawText%d"),m_ID));
}

CDrawText::~CDrawText(void)
{
	Free ();
}


void CDrawText::Free ()
{
	while (!DrawTextsVector.empty())
	{
		delete DrawTextsVector.back();
		DrawTextsVector.pop_back();
	}
}

CVisTexts *CDrawText::Add(const wstring &Name)
{
	CVisTexts *pVisTexts = Get (Name);
	if (pVisTexts)
		return NULL;
	pVisTexts = new CVisTexts ();
	pVisTexts->Name = Name;
	
	DrawTextsVector.push_back (pVisTexts);

	return pVisTexts;
}
CVisTexts *CDrawText::Get(const DWORD &Index)
{
	if (Index < Count())
		return DrawTextsVector[Index];

	return NULL;
}

CVisTexts *CDrawText::Get(const wstring &Name)
{
	std::vector<CVisTexts*>::iterator it;
	for (it = DrawTextsVector.begin(); it < DrawTextsVector.end(); it++)
	{
		if ((*it)->Name == Name)
			return (*it);
	}

	return NULL;
}
